# script to run all testcases in the specified directory on both codegen and
# sampleCodegen. The results of both of these are compared for each of the
# files.
# author: Maurya Talisetti

make clean > /dev/null 2>&1
make > /dev/null 2>&1

for i in ./testcases/mytestcases/*
do
./codegen < $i > /dev/null 2>&1
cp iloc.out iloc.out1
./sampleCodegen < $i > /dev/null 2>&1
cp iloc.out iloc.out2
diff iloc.out1 iloc.out2 >/dev/null 2>&1
if [ $? -eq 1 ]
then
    echo "Current file is $i"
    echo "Files are different"
    echo
fi

rm iloc.out1
rm iloc.out2
done
